import { createRouter, createWebHashHistory } from 'vue-router'
import {dynamicRoutes} from './route'
// @ts-ignore
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
NProgress.configure({ showSpinner: false });

const router = createRouter({
    history: createWebHashHistory(),
    routes:dynamicRoutes
})
// 路由加载前
router.beforeEach((to,form,next)=>{
    NProgress.start();
    if (to.path == '/'){
        next({path:'/blog'})
    }
    next()
})
// 路由加载后
router.afterEach(() => {
    NProgress.done();
});
export default router
